home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / MPW_TOOL / TOOLS / TOOLS_WI / ICON_8 / CALLING_ / CALLBOTH.ICN next >
Text File  |  1990-04-08  |  1KB  |  56 lines

  1.  
  2. procedure main()
  3.    write(&version)
  4.    write(&host)
  5.    every write(&features)
  6.    write("the sin of 45 is ", callout("asinh", "45"))
  7.    callout("printf", "this is a test")
  8.    write("the string is 25;", " the number = ", callout("atoi", "25"))
  9.    recurse(3)
  10. end
  11.  
  12. procedure recurse(n)
  13.    static cnt
  14.    initial cnt := 0
  15.    write("in routine recurse")
  16.    write("cnt = ", cnt, "; n = ", n)
  17.    cnt := cnt + 1
  18.    if (cnt < n) then
  19.       callout("myroutine")
  20. end
  21.  
  22. procedure wordcount(n)
  23.    local t, line, x, i
  24.    static letters
  25.    initial letters := &lcase ++ &ucase
  26.    t := table(0)
  27.    while line := read() do
  28.       line ? while tab(upto(letters)) do
  29.          t[tab(many(letters))] +:= 1
  30.    x := sort(t,3)
  31.    every i := 1 to *x - 1 by 2 do
  32.       write(left(x[i],n),x[i + 1])
  33.    return "true"
  34. end
  35.  
  36. procedure testing(n)
  37.    static cnt
  38.    initial cnt := 2
  39.    /n := -1
  40.    if (n < 0) then
  41.       fail
  42.    else if (n = 0) then
  43.       return n
  44.    while n > 0 do {
  45.       m := cnt
  46.       cnt -:= 1
  47.       suspend m
  48.       }
  49. end
  50.  
  51. procedure junk()
  52.    write(reverse("this is not a test"))
  53.    display()
  54.    write(find("is", "this is a test"))
  55. end
  56.